<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [1, 4, 6, 7, 5, 2, 10, 0];
        // 冒泡排序
        Array.prototype.method1 = function () {
            for (let i = 0; i < this.length; i++) {
                for (let j = 0; j < this.length - i - 1; j++) {
                    if (this[j] > this[j + 1]) {
                        let temp = this[j];
                        this[j] = this[j + 1];
                        this[j + 1] = temp;
                    }
                }
            }
            return this;
        }

        // 选择排序
        Array.prototype.method2 = function () {
            for (let i = 0; i < this.length; i++) {
                minIndex = i;
                for (let j = i + 1; j < this.length; j++) {
                    if (this[j] < this[minIndex]) {
                        minIndex = j;
                    }
                }
                let temp = this[i];
                this[i] = this[minIndex];
                this[minIndex] = temp;
            }
            return this;
        }

        // 快速排序
        Array.prototype.method3 = function () {

        }

        console.log(arr.method2());

        console.log(Boolean(NaN));
    </script>
</body>

</html>